Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

234
Vistas
Draw curve -> Get equation

A part of the project I am working on requires an interface where a user draws a curve, and I want to output an approximate mathematical equation of that curve to perform a variety of tests on it.

I have thought of 2 approaches so far and was wondering if they are feasible or if there exists a better way of approaching the problem that I am missing/ cool mathematical trick that allows me to pull this off.

Approach 1:

Instead of having users draw a curve, give them the option of inserting bezier curve points and tweaking them to make their curve. Since bezier curves have a parametric equation that describes them, I could directly get the exact equation.

Cons: -It's more cumbersome for users to tweak and make a bezier than simply draw a curve

Approach 2:

Get the curve drawn and extract 'n' points. (I don't think this should be hard to do). Somehow go from these 'n' points to an equation of a curve passing through them. Naturally 'n' would be pretty large, say 100. Is there a neat way to get an equation for the "simplest continuous function" passing through 'n' points?

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

Approach 1 -- insert Bezier points and tweak control points -- is used in a lot of vector drawing programs, especially CAD-type applications where precision is important and points are laid out on a grid, etc. It is a slower way to draw, but it's used in these situations, because it's really difficult to draw a freehand curve carefully.

Approach 2 -- just draw and get an smooth approximation -- is also pretty popular when precision isn't required. I'm not sure what methods are usually used for this, or even if there is a "usually", but I don't think it's particularly difficult to do a pretty good job. I would:

  1. Connect all the points with line segments in the order in which they were drawn.
  2. Apply the Ramer-Douglas-Peucker algorithm to reduce the number of points.
  3. Interpolate the points with cubic spline interpolation. Be careful looking this up-there are many flavors of cubic spline interpolation and their names overlap. I would specifically prefer the versions that preserve 2nd derivative continuity.
about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda